<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:substituteby="template::docHead(#{system.name},'授权管理')">
</head>
<body>
<script type="text/javascript" th:substituteby="system/authorization/perms.js::js"></script>
<nav th:replace="template::nav"></nav>
<div class="container-fluid">
    <div class="row">
        <div class="col-sm-3 col-md-2 sidebar">
            <div id="tree"></div>
        </div>
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
            <ol class="breadcrumb">
                <li>系统设置</li>
                <li><a th:href="@{/system/authorization}">权限管理</a></li>
                <li><a th:href="@{/system/authorization/perms/query}">授权管理</a></li>
            </ol>
            <nav class="navbar navbar-default">
                <div class="container-fluid">
                    <div class="navbar-header">
                        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                                data-target="#bs-example-navbar-collapse-2" aria-expanded="false">
                            <span class="sr-only">Toggle navigation</span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        <a class="navbar-brand" href="#">授权管理：</a>
                    </div>
                    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-2">
                        <form class="navbar-form navbar-right" role="search"
                              th:action="@{/system/authorization/perms/query}" method="get">
                            <div class="form-group">
                                <input type="text" class="form-control" placeholder="查询" id="dataType" name="dataType"
                                       th:value="${vo.dataType}"/>
                                <input type="hidden" name="page.pageSize" id="pageSize"
                                       th:value="${result.page.pageSize}"/>
                                <input type="hidden" name="page.currentPage" id="currentPage"
                                       th:value="${result.page.currentPage}"/>
                            </div>
                            <button type="submit" class="btn btn-default">查询</button>
                        </form>
                    </div>
                </div>
            </nav>
            <div class="modal fade" id="myModal-del" tabindex="-1" role="dialog" aria-labelledby="myModalLabel-del"
                 aria-hidden="true">
                <div class="modal-dialog" style="width: 400px;">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close"
                                    data-dismiss="modal" aria-hidden="true">
                                &times;
                            </button>
                            <h4 class="modal-title" id="myModalLabel-del">
                                删除授权
                            </h4>
                        </div>
                        <div class="modal-body">
                            <p>
                                确定要删除授权<span id="delUserName"></span>吗？
                            </p>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default"
                                    data-dismiss="modal">关闭
                            </button>
                            <button type="button" class="btn btn-primary" id="doDel">
                                确定
                            </button>
                        </div>
                    </div><!-- /.modal-content -->
                </div><!-- /.modal -->
            </div>
            <div class="modal fade" id="myModal-update" tabindex="-1" role="dialog"
                 aria-labelledby="myModalLabel-update"
                 aria-hidden="true">
                <div class="modal-dialog" style="width: 400px;">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close"
                                    data-dismiss="modal" aria-hidden="true">
                                &times;
                            </button>
                            <h4 class="modal-title" id="myModalLabel-update">
                                修改授权
                            </h4>
                        </div>
                        <form th:action="@{/system/authorization/perms/update}" method="post">
                            <div class="modal-body">
                                <input type="hidden" name="roleId" id="roleId"/>
                                <div class="input-group" style="margin-bottom: .5em;">
                                    <span class="input-group-addon">&nbsp;角&nbsp;&nbsp;色&nbsp;&nbsp;名&nbsp;</span>
                                    <input type="text" id="jiese" name="roleName" class="form-control" disabled="true "
                                           placeholder="角色名"
                                           aria-describedby="basic-username"/>
                                </div>
                                <div class="input-group" style="margin-bottom: .5em;">
                                    <span class="input-group-addon">&nbsp;描&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;述&nbsp;</span>
                                    <input type="text" id="miaoshu" name="description" class="form-control"
                                           disabled="true "
                                           placeholder="描述"
                                           aria-describedby="basic-username"/>
                                </div>
                                <label>拥有权限</label>
                                <input id="id" name="id" value="" type="hidden"/>
                                <div class="table-responsive" style="margin-bottom: .5em;">
                                    <span class="input-group-addon">&nbsp;对&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;象&nbsp;</span>
                                    <input type="text" id="duixiang" name="dataType" class="form-control"
                                           placeholder="描述"
                                           aria-describedby="basic-username"/>
                                </div>
                                <div class="table-responsive" style="margin-bottom: .5em;">
                                    <span class="input-group-addon">&nbsp;操&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;作&nbsp;</span>
                                    <input type="text" id="quanxian" name="operation" class="form-control"
                                           placeholder="权限"
                                           aria-describedby="basic-username"/>
                                </div>
                                <div class="table-responsive" style="margin-bottom: .5em;">
                                    <span class="input-group-addon">&nbsp;范&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;围&nbsp;</span>
                                    <input type="text" id="fanwei" name="dataDomain" class="form-control"
                                           placeholder="范围"
                                           aria-describedby="basic-username"/>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-default"
                                        data-dismiss="modal">关闭
                                </button>
                                <button type="submit" class="btn btn-primary">
                                    确定
                                </button>
                            </div>
                        </form>
                    </div><!-- /.modal-content -->
                </div><!-- /.modal -->
            </div>
            <div class="table-responsive">
                <table class="table table-striped">
                    <thead>
                    <tr>
                        <th>序号</th>
                        <th>角色</th>
                        <th>描述</th>
                        <th>对象</th>
                        <th>权限</th>
                        <th>范围</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each="result:${result.result}">
                        <td th:text="${result.id}"></td>
                        <td th:text="${result.role.rolename}"></td>
                        <td th:text="${result.role.description}"></td>
                        <td th:text="${result.dataType}"></td>
                        <td th:text="${result.operation}"></td>
                        <td th:text="${result.dataDomain}"></td>
                        <td>
                            <button type="button" class="btn btn-xs btn-info" th:onclick="'showUser111('+${result.id}+')'">
                                <span class="glyphicon glyphicon-edit" aria-hidden="false"></span>
                            </button>
                            &nbsp;&nbsp;
                            <button type="button" class="btn btn-xs btn-danger"
                                    th:onclick="'confirmDelUser('+${result.id}+')'">
                                <span class="glyphicon glyphicon-remove" aria-hidden="false"></span>
                            </button>
                        </td>
                    </tr>
                    </tbody>
                </table>
                <nav style="float: right;">
                    <ul th:if="${result.page.totalPage}>0" class="pagination">
                        <li>
                            <a th:href="@{/system/authorization/perms/query(pager.currentPage=${1},page.pageSize=${result.page.pageSize},roleName=${vo.roleName})}"
                               aria-label="Previous">
                                <span aria-hidden="true">&laquo;</span>
                            </a>
                        </li>
                        <li th:each="i,status:${#numbers.sequence( 0, result.page.totalPage-1)}">
                            <a th:href="@{/system/authorization/perms/query(pager.currentPage=${status.index+1},page.pageSize=${result.page.pageSize},roleName=${vo.roleName})}"
                               th:text="${status.index}+1"></a>
                        </li>

                        <li>
                            <a th:href="@{/system/authorization/perms/query(pager.currentPage=${result.page.totalPage},page.pageSize=${result.page.pageSize},roleName=${vo.roleName})}"
                               aria-label="Next">
                                <span aria-hidden="true">&raquo;</span>
                            </a>
                        </li>
                    </ul>
                </nav>
            </div>
        </div>
    </div>
</div>
</body>
</html>
